package com.hujf.mapreduce.outputformat;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @author Hujf
 * @title: LogReducer
 * @date 2021/4/19:53
 * @description: TODO
 */
public class LogReducer extends Reducer<Text, NullWritable, Text,NullWritable> {
    @Override
    protected void reduce(Text key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        for(NullWritable nullWritable:values){
            //因为reduce 的write会对key去重  所以需要循环
            context.write(key,NullWritable.get());
        }
    }
}
